package com.example.milin_goodnigth;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	private static final int RESULT_SETTINGS = 1;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
       // Sleeping;
        Button cmd = (Button) findViewById(R.id.btnStart);
        cmd.setOnClickListener(new OnClickListener(){
        	
			public void onClick(View arg0) {
				watchYoutubeVideo ("NicMZ589snY");
				//HCQjk45Bsq8 -- Older file
			}
        	
        });

        // Playing;
        Button cmdPlay = (Button) findViewById(R.id.btnPlaying);
        cmdPlay.setOnClickListener(new OnClickListener(){

            public void onClick(View arg0) {
                 watchYoutubeVideo ("Hd6apPU11Gc");
                //Baby Einstein -- Baby Beethoven Symphony of Fun
                }

        });

        // Crying;
        Button cmdCry = (Button) findViewById(R.id.btnCrying);
        cmdCry.setOnClickListener(new OnClickListener(){

            public void onClick(View arg0) {
                watchYoutubeVideo ("vfTUuZ1QY1w");
                //Stop Baby Crying - Nature's Miracle White Noise for Baby Colic -
            }

        });
        
    }
    

    
 
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
 
        switch (requestCode) {
        case RESULT_SETTINGS:
           // showUserSettings();
            break;
 
        }
 
    }
    
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public  void watchYoutubeVideo(String id){
        try{
             Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id));
             intent.putExtra("force_fullscreen",true);
             startActivity(intent);                 
             }catch (ActivityNotFoundException ex){
                 Intent intent=new Intent(Intent.ACTION_VIEW, 
                 Uri.parse("http://www.youtube.com/watch?v="+id));
                 intent.putExtra("force_fullscreen",true);
                 startActivity(intent);
             }
    }
}
